from flask import Flask, render_template
from flask.ext.wtf import Form
from flask.ext.script import Manager
from wtforms import StringField, SubmitField
from wtforms.validators import Required


class NameForm(Form):
	name = StringField('What is your name?', validators=[Required()])
	submit = SubmitField('Submit')
		

app = Flask(__name__)
manager = Manager(app)
app.config['SECRET_KEY'] = 'hard to guess string'

@app.route('/', methods=['GET', 'POST'])
def index():
	name = None
	form = NameForm()
	app.logger.info('test')
	if form.validate_on_submit():
		name = form.name.data
		form.name.data = ''
	return render_template('index.html', form = form, name = name)


if __name__ == '__main__':
	manager.run()